<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <cpn></cpn>
        <cpn></cpn>
    </div>
    <template id="cpn">
        <div>
            <h2>当前计数：{{count}}</h2>
            <button @click="decrement">-</button>
            <button @click="increment">+</button>
        </div>
    </template>
    <script src="../vue.js"></script>
    <script>


        Vue.component('cpn',{
            template:'#cpn',
            data(){
                return{
                    count:0
                }
            },
            methods: {
                decrement(){
                    this.count--
                },
                increment(){
                    this.count++
                }
            },
        })


        const app=new Vue({
            el:"#app",
            data:{

            },
            methods: {
                
            },
        })
    </script>
</body>
</html>